<% if diary_entries.present? %>
  <h2 class="text-body-secondary fs-5 mt-4"><%= t(".latest_diaries") %></h2>
  <div class="row row-cols-1 row-cols-md-2 g-4">
    <% diary_entries.each do |entry| %>
      <div class="col profile-diary-card">
        <div class="card h-100">
          <div class="card-body d-flex flex-column">
            <p class="card-title d-flex gap-2">
              <i class="bi bi-journal-text fs-2 my-n2 flex-shrink-0" aria-hidden="true"></i>
              <span class="visually-hidden"><%= t ".title_label" %></span>
              <%= link_to entry.title, diary_entry_path(@user, entry), :class => "align-self-center lh-sm" %>
            </p>
            <p class="card-text flex-grow-1"><%= truncate(strip_tags(entry.body.to_html), :length => 150) %></p>

            <div class="card-text d-flex justify-content-between align-items-center mt-auto">
              <small class="text-body-secondary d-flex gap-1 align-items-center">
                <i class="bi bi-chat fs-5 my-n1" aria-hidden="true"></i>
                <span class="visually-hidden"><%= t ".comments_label" %></span>
                <%= link_to t(".comments", :count => entry.comments.size), diary_entry_path(@user, entry, :anchor => "comments"), :class => "text-body-secondary" %>
              </small>
              <small class="text-body-secondary d-flex gap-1 align-items-center">
                <i class="bi bi-calendar fs-5 my-n1" aria-hidden="true"></i>
                <span class="visually-hidden"><%= t ".date_label" %></span>
                <span><%= l(entry.created_at.to_date, :format => :long) %></span>
              </small>
            </div>
          </div>
        </div>
      </div>
    <% end %>
  </div>
<% end %>
